package kgame5.pbe.atlantic.comp {
	import kgame5.pbe.atlantic.event.FSMEvent;
	import kgame5.pbe.atlantic.event.ViewEvent;
	import kgame5.pbe.atlantic.vo.EntityVO;
	import kgame5.pbe.engine.entity.EntityComponent;

	/**
	 * @author max
	 * 2010-12-13
	 * 一个comp,是个总控器,协调fsmBatch和viewComp等的工作，并负责与平级entity通信（发送和接收）,向最外层command通信
	 * 
	 * 处理内部组件通信的用on
	 * 处理来自外界的命令用handler
	 * 
	 * TODO 这个不应放到引擎中,因为各个业务并不相同~
	 */
	public class ControllerComp extends EntityComponent{
		private var fsmBatch:FSMBatchComp;
		private var vo:EntityVO;
		//private var view:ViewComp;
		public function ControllerComp(vo:EntityVO,fsmBatch:FSMBatchComp){
			this.vo	=vo;
			this.fsmBatch=fsmBatch;
			
			
			owner.eventDispatcher.addEventListener(FSMEvent.TYPE, onFSMEvent);
			owner.eventDispatcher.addEventListener(ViewEvent.TYPE, onViewEvent);
			//owner.eventDispatcher.addEventListener(EntityMessageEvent.TYPE, onEntityMessageEvent);//这个暂时不处理
			
			//gameCommand会发送到GamePlay
			//owner.eventDispatcher.addEventListener(GameCommandEvent.TYPE, onGameCommandEvent);
			
		}
		
		private function onFSMEvent(e:FSMEvent):void{
		}
		
		private function onViewEvent(e:ViewEvent):void{
			switch(e.name){
				case ViewEvent.EOF:
				break;
				case ViewEvent.CLICK:
				break;
			}
		}
		
//		private function onEntityMessageEvent(e:EntityMessageEvent):void{
//			
//		}
		
//		private function onGameCommandEvent(e:GameCommandEvent):void{
//			
//		}
		
//		//=================
//		//-事件接收
//		public function handleEntityMessage(mvo:EntityMessageVO):void{
//			
//		}
	}
}
